// index page
// ============

define(['require', 'zepto', 'JST', 'sui'], function(require, JST) {
  return {
    init: function() {
      this.initPage()
    },
    
    initPage: function() {
      var that = this;
      
      $(document).on('click', '.button-fill', function() {
        $.confirm('你确定要退出当前账户？', function() {
          var deffer = $.ajax({
            url: window.__CTX__.root + "/logout",
            type: 'GET',
            dataType: 'json',
            timeout: 1000,
            cache: false
          })
          
          deffer.done(function(response){
        	  if(response.code == 0) {
        		  window.location.href = window.__CTX__.root + "/logout-message"
        	  } else {
        		  console.log(response);
        	  }
          })
        })
      })
      
    }
  }
})